<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="java.util.List"%>
<%@page import="cn.company.database.DBUtils"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="cn.company.bean.Sort"%>
<%@page import="cn.company.bean.Advertising"%><html>
<head>
<%
	String path = request.getContextPath();
	List<Advertising> advs = DBUtils.getAdvs();
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>网站后台管理系统</title>
<script language="javascript" src="<%=path %>/OurHome/images/jquery.js"></script>
<link href="<%=path %>/OurHome/css/index.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function callback(msg){
		 document.getElementById("msg").innerHTML = msg;  
		 document.getElementById("path").value=msg;
	}
</script>
</head>
<body>
	<div id="mainDiv">
		<c:import url="../public/top.jsp" />
		<div id="centerDiv">
			<c:import url="../public/navigation.jsp"></c:import>
			<div id="right"> 
				<div id="current">&nbsp;&nbsp;&nbsp;&nbsp;当前位置: 广告管理</div>
				<div id="form">
					<P>&nbsp;</P>
					<fieldset>
						<legend>添加广告:</legend>
						<form action="<%=path %>/OurHome/uploadAttaches.jsp" method="post" enctype="multipart/form-data" target="uploadIframe">
							添加广告图片：<input type="file" name="upload"/>
							<input type="submit" value="上传"/><br>
							<span id="msg"></span>
						</form>
						<iframe name="uploadIframe" id="uploadIframe" style="display:none"></iframe>
						<form action="<%=path %>/OurHomeControlServlet" method="post">
							<input type="hidden" name="action" value="addadvertising" />
							<input type="hidden" name="path" id="path"/>
							广告名称：<input type="text" id="name" name="name" /><br>
							类型:
							<select name="type">
								<option selected="selected">==请选择==</option>
								<option value="荣誉广告">荣誉广告</option>
								<option value="企业文化左下角广告">企业文化左下角广告</option>
								<option value="产品服务左下角广告">产品服务左下角广告</option>
								<option value="解决方案左下角广告">解决方案左下角广告</option>
								<option value="成功案例左下角广告">成功案例左下角广告</option>
								<option value="关于我们左下角广告">关于我们左下角广告</option>
								<option value="解决方案右上角广告">解决方案右上角广告</option>
								<option value="成功案例右上角广告">成功案例右上角广告</option>
								<option value="企业文化右上角广告">企业文化右上角广告</option>
								<option value="关于我们右上角广告">关于我们右上角广告</option>
								<option value="其他广告">其他广告</option>
							</select><br>
							&nbsp;<input type="submit" value="提交内容" id="submit" name="submit"/>
						</form>
					</fieldset>
					<P>&nbsp;</P>
					<table border="1" cellpadding="0" cellspacing="0" style="border-color:#000000;">
						<tr bgcolor="#e8e8e0">
							<td width="200">广告名称</td>
							<td width="300">图片路径</td>
							<td width="300">广告类型</td>
							<td width="50" align="center">删除</td>
						</tr>
						<%
							for(int i = 0;i < advs.size();i++){
							%>
							<tr>
								<td><%=advs.get(i).getAdvName() %></td>
								<td><%=advs.get(i).getImagepath() %></td>
								<td><%=advs.get(i).getType() %></td>
								<td align="center"><a href="<%=path %>/OurHome/delete.jsp?id=<%=advs.get(i).getId()%>&table=advertising&redirect=<%=path %>/OurHome/adv/advertising.jsp ">删除</a></td>
							</tr>
							<%
							}
						%>
					</table>
					<p>&nbsp;</p>
				</div>
			</div>
		</div>
		<div id="bottomDiv"></div>
	</div>
	<script language="javascript">
		$("#test1").toggle(function(){$("#test").slideDown();},function(){$("#test").slideUp();});
	</script>
</body>
</html>
